//
// Created by xili on 2024/8/9 21:15.
// Go big or go home.
//
#include "leetcode.h"

class Solution {
public:
    vector<int> findIntersectionValues(vector<int> &nums1, vector<int> &nums2) {
        unordered_set<int> s1(nums1.begin(), nums1.end()), s2(nums2.begin(), nums2.end());
        vector<int> res(2);
        for (int x: nums1) {
            if (s2.count(x)) {
                res[0]++;
            }
        }
        for (int x: nums2) {
            if (s1.count(x)) {
                res[1]++;
            }
        }
        return res;
    }
};